/************************************************************************************\
This source file is part of the Universal Actor Library                              *
For latest info, see http://libuniactor.sourceforge.net/                             *
**************************************************************************************
Copyright (c) 2010 Kresimir Spes (kreso@cateia.com)                                  *
*                                                                                    *
* This program is free software; you can redistribute it and/or modify it under      *
* the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php   *
\************************************************************************************/
#ifndef _Actor_h
#define _Actor_h

#include "UniActorExport.h"
#include <gtypes/Vector3.h>
#include <hltypes/hstring.h>
#include <list>

namespace UniActor
{
	class Job;
	
	class UniActorExport Actor
	{
	protected:
		std::list<Job*> mJobQueue;
		
		gtypes::Vector3 mPosition,mDirection;
		hstr mActorName;
		float mSpeed;
		
		void _popJob();
	public:
		Actor(hstr name="unnamed actor");
		virtual ~Actor();
		hstr getActorName() { return mActorName; }
		
		virtual void OnStartMovement();
		virtual void OnEndMovement();
		virtual void OnDirectionChanged(gtypes::Vector3 old);
		virtual void OnPositionChanged(gtypes::Vector3 old);
		virtual void OnStartAnimation(chstr ani_name);
		virtual void OnEndAnimation(chstr ani_name);
		virtual void setAnimationFrame(chstr ani_name, float time);
		virtual float getAnimationTime(chstr ani_name);
		
		virtual void setSpeed(float speed) { mSpeed=speed; }
		virtual float getSpeed() { return mSpeed; }
		
		hstr getCurrentJobType();
		Job* getCurrentJob();
		Job* getLastJob();
		Job* removeLastJob(bool destroy_job=1);
		std::list<Job*>& getJobQueue() { return mJobQueue; }

		void addJob(Job* job);
		void insertJob(unsigned int index,Job* job);
		void clearJobs();
		int getJobQueueSize();
		virtual void setPosition(float x,float y,float z);
		virtual void setPosition(gtypes::Vector3 v);
		void setDirection(float x,float y,float z);
		void setDirection(gtypes::Vector3 v);
		virtual gtypes::Vector3 getActorPosition();
		virtual gtypes::Vector3 getDirection();
		
		
		virtual void update(float time_increase);
	};
}

#endif
